package com.gitee.lw114514.tliasweb.service.impl;
import com.gitee.lw114514.tliasweb.mapper.EmpLogMapper;
import com.gitee.lw114514.tliasweb.pojo.EmpLog;
import com.gitee.lw114514.tliasweb.service.EmpLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

//需求：无论添加员工是否成功，都要记录日志，这时就要给这个方法单独建一个事务
@Transactional(propagation = Propagation.REQUIRES_NEW)
//为方法添加新事务
@Service
public class EmpLogServiceImpl implements EmpLogService {

    @Autowired
    private EmpLogMapper empLogMapper;

    @Override
    public void insertLog(EmpLog empLog) {
        empLogMapper.insert(empLog);
    }
}
